Skip to content

Fix: fix hidden question not available in anonymous forms - #69

Open
stonebuzz wants to merge 1 commit into
mainfrom
fix_hidden_field
Open

stonebuzz wants to merge 1 commit into
mainfrom
fix_hidden_field

Conversation

@stonebuzz

Copy link
Copy Markdown
Contributor

Checklist before requesting a review

Please delete options that are not relevant.

  • I have performed a self-review of my code.
  • I have added tests (when available) that prove my fix is effective or that my feature works.
  • I have updated the CHANGELOG with a short functional description of the fix or new feature.
  • This change requires a documentation update.

Description

The hidden question type kept the default behavior of AbstractQuestionType,
which excludes it from forms answered without authentication. As a result,
every hidden question was dropped from anonymous forms and its value was
never saved.

The submitted value is never used: prepareEndUserAnswer() always returns the
configured default value, so the type can be enabled for anonymous forms.

Screenshots (if appropriate):

@stonebuzz stonebuzz self-assigned this Oct 19, 2026
@stonebuzz stonebuzz added the bug Something isn't working label Oct 19, 2026
@stonebuzz
stonebuzz marked this pull request as draft October 19, 2026 12:26
@stonebuzz
stonebuzz marked this pull request as ready for review October 19, 2026 12:36

@Rom1-B Rom1-B left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IpAddressQuestionandHostnameQuestion` also compute their value server-side; should they be allowed for unauthenticated access too?

Comment thread tests/Model/QuestionType/HiddenQuestionTest.php Outdated
@stonebuzz

Copy link
Copy Markdown
Contributor Author

Need backport for GLPI 11

@stonebuzz
stonebuzz force-pushed the fix_hidden_field branch 2 times, most recently from 0ce1baf to 42d57cf Compare October 20, 2026 07:29
@stonebuzz stonebuzz mentioned this pull request Oct 20, 2026
3 of 4 tasks

@Herafia Herafia left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stonebuzz solveAltchaChallenge is copied from SubmitAnswerControllerTest in the core. If more tests are added, it might be better to move it to AdvancedFormsTestCase or a trait. We can also do that later. ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants